/**
 * 店铺相关API
 */

import request from '../utils/request'


/**
 * 获取行业分类
 * @param params
 */
export function oneCategory(pid) {
  return request.ajax({
    url: `/shops/category/${pid}`,
    method: 'get',
    loading:true,
  })
}

/**
 * 获取店铺列表
 * @param params
 */
export function getShopList(params) {
  return request.ajax({
    url: '/shops/list',
    method: 'get',
    loading:true,
    params
  })
}

/**
 * 会员初始化店铺信息
 */
export function initApplyShop() {
  return request.ajax({
    url: '/shops/apply',
    method: 'post',
    needToken: true
  })
}

/**
 * 获取店铺信息
 */
export function getApplyShopInfo() {
  return request.ajax({
    url: '/shops/apply',
    method: 'get',
    needToken: true
  })
}

/**
 * 会员申请开店步骤
 * @param step
 * @param params
 */
export function applyShopStep(step, params) {
  return request.ajax({
    url: `/shops/apply/step${step}`,
    method: 'put',
    needToken: true,
    params
  })
}
/**
 * 会员申请开店设置密码获取验证码
 * @param step
 * @param params
 */
export function applyShopSendCode(data) {
  return request.ajax({
    url: `/passport/find-pwd/send-shop`,
    method: 'post',
    needToken: true,
    data
  })
}
/**
 * 会员申请开店设置密码
 * @param step
 * @param params
 */
export function applyShopSetPassword(data) {
  return request.ajax({
    url: `/passport/find-pwd/update-password-shop`,
    method: 'put',
    needToken: true,
    data
  })
}

/**
 * 获取店铺基本信息
 * @param shop_id
 */
export function getShopBaseInfo(shop_id) {
  return request.ajax({
    url: `/shops/${shop_id}`,
    method: 'get'
  })
}

/**
 * 获取店铺幻灯片
 * @param shop_id
 */
export function getShopSildes(shop_id) {
  return request.ajax({
    url: `/shops/sildes/${shop_id}`,
    method: 'get'
  })
}

/**
 * 获取店铺导航
 * @param shop_id
 */
export function getShopNav(shop_id) {
  return request.ajax({
    url: `/shops/navigations/${shop_id}`,
    method: 'get'
  })
}

/**
 * 获取店铺分类【分组】
 * @param shop_id
 */
export function getShopCategorys(shop_id) {
  return request.ajax({
    url: `/shops/cats/${shop_id}`,
    method: 'get'
  })
}

/**
 * 获取店铺首页模快数据
 * 
 */
export function getAppHomeData(params) {
  return request.ajax({
    url: `/pages/model/getAppHomeData`,
    method: 'get',
    params
  })
}

export function newGoods(params) {
  return request.ajax({
    url: `/goods/search/new`,
    method:'get',
    params
  })
}

/**
 * 获取店铺活动所有标签
 * @param shop_id
 */
export function getShopTag(params) {
  return request.ajax({
    url: "/goods/tags/all",
    method: 'get',
    params
  })
}

export function getTagGoods(seller_id, mark, num) {
  return request.ajax({
    url: `/goods/tags/${mark}/goods`,
    method: 'get',
    loading: false,
    params: {
      seller_id,
      mark,
      num
    }
  })
}


